package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.MemberBalanceOperate;
import cn.wolfcode.crm.query.PageResult;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IMemberBalanceOperateService;
import cn.wolfcode.crm.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("memberRecharge")
public class MemberBalanceOperateController {

    @Autowired
    private IMemberBalanceOperateService service;

    @RequestMapping("")
    public String main(){
        return "member/memberRecharge";
    }

    @RequestMapping("list")
    @ResponseBody
    public PageResult list(QueryObject qo){
        return service.queryPage(qo);
    }

    @RequestMapping("save")
    @ResponseBody
    public JsonResult save(MemberBalanceOperate entity){
        JsonResult jr = new JsonResult();
        try {
            service.save(entity);
        } catch (Exception e) {
            e.printStackTrace();
            jr.setMsg(e.getMessage());
        }
        return jr;
    }

}
